﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
namespace WebApplication1
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        SqlHelper SqlHelper = new SqlHelper();
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            //string a = "server=.;uid=sa;pwd=123456;database=Student_db";
            //SqlConnection sql = new SqlConnection(a);
            //sql.Open();
            //SqlCommand sqlCommand = new SqlCommand("select * from [StudentInfo] where stu_id=@id and password =@pas",sql);
            //SqlParameter[] sqls =
            // {
            //    new SqlParameter("@id",TextBox1.Text),
            //     new SqlParameter("@pas",TextBox2.Text)
            //};
            //sqlCommand.Parameters.AddRange(sqls);
            //SqlDataReader sqlData = sqlCommand.ExecuteReader();
            //if (sqlData.Read())
            //{
            //    Literal1.Text = "assa";
            //}
            string a = "select * from [StudentInfo] where stu_name=@name and password =@pas";
            SqlParameter[] sql =
            {
                new SqlParameter("@name",TextBox1.Text),
                 new SqlParameter("@pas",TextBox2.Text)
            };
            DataTable dt= SqlHelper.table(a, sql);
            if (dt.Rows.Count>0)
            {
                Session["aaa"] = TextBox1.Text;
                Response.Redirect("WebForm3.aspx");

            }
        }
    }
}